﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000017 RID: 23
	public abstract class Grounder : MonoBehaviour
	{
		// Token: 0x06000167 RID: 359
		public abstract void Reset();

		// Token: 0x06000168 RID: 360 RVA: 0x0001F2AC File Offset: 0x0001D4AC
		public Vector3 GetSpineOffsetTarget()
		{
			Vector3 vector = Vector3.zero;
			for (int i = 0; i < this.solver.legs.Length; i++)
			{
				vector += this.GetLegSpineBendVector(this.solver.legs[i]);
			}
			return vector;
		}

		// Token: 0x06000169 RID: 361 RVA: 0x00002F16 File Offset: 0x00001116
		public void LogWarning(string message)
		{
			Warning.Log(message, base.transform, false);
		}

		// Token: 0x0600016A RID: 362 RVA: 0x0001F2F8 File Offset: 0x0001D4F8
		public Vector3 GetLegSpineBendVector(Grounding.Leg leg)
		{
			Vector3 legSpineTangent = this.GetLegSpineTangent(leg);
			float d = (Vector3.Dot(this.solver.root.forward, legSpineTangent.normalized) + 1f) * 0.5f;
			float magnitude = (leg.IKPosition - leg.transform.position).magnitude;
			return legSpineTangent * magnitude * d;
		}

		// Token: 0x0600016B RID: 363 RVA: 0x0001F364 File Offset: 0x0001D564
		public Vector3 GetLegSpineTangent(Grounding.Leg leg)
		{
			Vector3 result = leg.transform.position - this.solver.root.position;
			if (!this.solver.rotateSolver || this.solver.root.up == Vector3.up)
			{
				return new Vector3(result.x, 0f, result.z);
			}
			Vector3 up = this.solver.root.up;
			Vector3.OrthoNormalize(ref up, ref result);
			return result;
		}

		// Token: 0x0600016C RID: 364
		public abstract void OpenUserManual();

		// Token: 0x0600016D RID: 365
		public abstract void OpenScriptReference();

		// Token: 0x040000A8 RID: 168
		[Tooltip("The master weight. Use this to fade in/out the grounding effect.")]
		[Range(0f, 1f)]
		public float weight = 1f;

		// Token: 0x040000A9 RID: 169
		[Tooltip("The Grounding solver. Not to confuse with IK solvers.")]
		public Grounding solver = new Grounding();

		// Token: 0x040000AA RID: 170
		public Grounder.GrounderDelegate OnPreGrounder;

		// Token: 0x040000AB RID: 171
		public Grounder.GrounderDelegate OnPostGrounder;

		// Token: 0x040000AC RID: 172
		public bool initiated;

		// Token: 0x02000018 RID: 24
		// (Invoke) Token: 0x0600016F RID: 367
		public delegate void GrounderDelegate();
	}
}
